// *****************************************************************************
//
// Copyright (c) 2011. Hao Liu and Lin Gui, Ocean University of China and
// Carneggie Mellon University. This code may be used, distribute, or modified
// only for research purposes or under license from Ocean University of China or
// Carnegie Mellon University. This notice must be retained in all copies.
//
// *****************************************************************************

/*!
  \file     iplqimage.h
  \author   Hao Liu
  \version  1.0
  \date     2011/10/31
  \brief    Header file for IplQImage class which provides universal image data storage for IplImage and QImage
*/

#ifndef IPLQIMAGE_H
#define IPLQIMAGE_H

#include <QObject>
#include <QtGui/QImage>
#include <cv.h>

class IplQImage : public QObject
{
    Q_OBJECT

public:
    IplQImage(const IplImage *img, int channels, QObject *parents = 0);
    ~IplQImage();

    IplImage *getIpl();
    QImage *getQImage();

    int getImageWidth();

    void updateImage(const IplImage *img);
    void updateImage(const IplImage *img, int channels);

private:
    IplImage *m_IplImage;       //!< Pointer for IplImage which share memory with QImage
    QImage *m_QImage;           //!< Pointer for QImage which share memory with IplImage

    int m_ImageWidth;           //!< Image width
    int m_ImageHeight;          //!< Image height
    int m_ImageChannels;        //!< Color channels. Not available yet.

};

#endif
